<template>
	<view class="container monitor-container">
		<view class="monitor-list">
			
		</view>
		<view class="not-more" v-if="isLoading">加载中...</view>
		<view class="null-page" v-else-if="pageList.length<=0 ">
			<text class="iconfont">&#xe642;</text>
			<view class="null-page-tips">暂无数据~</view>
		</view>
		<view class="not-more" v-else-if="notMore">没有更多了...</view>
	</view>
</template>

<script setup lang="ts">
	import { onMounted, ref } from 'vue';
	import { hideLoading, showLoading, showToast } from '@/common/util';
	import { onPullDownRefresh, onReachBottom } from "@dcloudio/uni-app"
	import api from '@/common/api';
	const isLoading = ref(false)
	const pageList = ref([])
	const notMore = ref(true)
	
	onMounted(async () => {
		getPageList()
	})
	
	const pageSize = 10
	let pageNum = 1
	const getPageList = async () => {
		showLoading()
		isLoading.value = true
		try {
			// const res = await api.getMonitorList({})
			// if (res.rows.length < pageSize) notMore.value = true
			// pageList.value = pageList.value.concat(res.rows)
		} finally {
			isLoading.value = false
			hideLoading()
		}
	}
	const loadMore = () => {
		if (isLoading.value) return
		if (notMore.value) return
		pageNum = pageNum + 1
		getPageList()
	}
	const refreshList = () => {
		notMore.value = false
		pageNum = 1
		pageList.value = []
		getPageList()
	}
	onReachBottom(() => {
		loadMore()
	})
	onPullDownRefresh(() => {
		refreshList()
		uni.stopPullDownRefresh()
	})

</script>

<style lang="scss">
	.monitor-container {
		
	}
</style>